package zzz.Text.text7;

import java.util.Scanner;

public class luomashuzi {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String number;
        while (true) {
            System.out.println("请输入一个字符串");
            number =sc.nextLine();
            boolean flag =checkStr(number);
            if(flag){
                break;
            }else {
                System.out.println("当前的字符串不符合规则,请重新输入");
                continue;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < number.length(); i++) {
            char c =number.charAt(i);
            int num = c-48;
            String luoMa = changeLuoMa(num);
            sb.append(luoMa);
        }
        System.out.println(sb);
    }
    public static  String changeLuoMa(int number){
        String[] arr = {" "," I"," II"," III"," IV"," V"," VI"," VII"," VIII"," IX"};
        return arr[number];
    }



    public static boolean checkStr(String str){
        if(str.length()>9){
            return false;
        }
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if(c<'0'||c>'9'){
                return false;
            }
        }
        return true;
    }
}
